package com.wt.struggle.goodbye.main.adapter

import android.content.Context
import android.graphics.BitmapFactory
import android.support.v7.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
import com.wt.struggle.goodbye.R
import com.wt.struggle.goodbye.base.ProBaseAdapter
import com.wt.struggle.goodbye.info.ShareInfo
import kotlinx.android.synthetic.main.load_info_item.view.*

class ShareLoadAdapter(context: Context, list: ArrayList<ShareInfo>) : ProBaseAdapter<ShareInfo>(context, list) {

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
        val info = list[position]
        val vh = holder as VH
        vh.loadImagePic.setImageBitmap(BitmapFactory.decodeResource(context.resources, info.initPic))
        vh.tvLoadTitle.text = info.title

    }

    override fun onCreateView(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
        return VH(inflater.inflate(R.layout.load_info_item, parent, false))
    }

    override fun onUpdateHolder(holder: RecyclerView.ViewHolder, position: Int, payloads: MutableList<Any>) {
    }

    inner class VH(view: View) : RecyclerView.ViewHolder(view) {
        val loadImagePic = view.loadImagePic
        val tvLoadTitle = view.tvLoadTitle

    }
}